<table border="1"><tr><td><b>Book Title</b></td><td><b>Author</b></td></tr>
    <?php 
    foreach ($data['carti'] as $k=>$row) {
    echo '<tr><td>' . '<a href="book.php?book_id='.$k.'">'.$row['titlu'].'</td>
        <td>';
  
    $ar = array();
    foreach ($row['autori'] as $k => $va) {
        $ar[] = '<a href="index.php?author_id=' . $k . '">' . $va . '</a>';

    }
    echo implode(' , ', $ar) . '</td></tr>';
}
?>
</table>